package com.movie.controller;

import com.movie.common.HttpResult;
import com.movie.utils.FileUpload;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author Liu Jiaquan
 * @Description
 * @date 2024/8/4 13:46
 */
@RestController
public class FileController {
    @Autowired
    private FileUpload fileUpload;

    @PostMapping("/uploadImg")
    public HttpResult<String> uploadImg(@RequestBody MultipartFile file){
        String url = fileUpload.upload(file);
        return HttpResult.success(url);
    }
}
